package com.lcm.oj.lanqiao.year2021.moni.c1;

import java.util.Scanner;

/**
 * @author Coder-lcm
 * @date 2021/4/17
 */
public class T9 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }
        int res = 0;
        for (int i = 0; i < n-1; i++) {
            res = Math.max(res, nums[i+1] - nums[i]);
        }
        System.out.println(res);
    }
}
